<template>
  <span>
    <el-dialog :visible="splitVisible"
               title="拆单"
               width="50%"
               :before-close="close"
               append-to-body>
      <el-form :model="ruleForm"
               label-width="90px"
               ref="ruleForm">
        <el-form-item label="拆单类型">
          <el-radio-group v-model="ruleForm.status">
            <el-radio :label="1">线路拆单</el-radio>
            <el-radio :label="2">数量拆单</el-radio>
          </el-radio-group>
          <!-- <el-radio v-model="ruleForm.status"
                    :label="1">线路拆单</el-radio>
          <el-radio v-model="ruleForm.status"
                    :label="2">数量拆单</el-radio> -->
        </el-form-item>
      </el-form>
      <div slot="footer"
           class="dialog-footer">
        <el-button type="primary"
                   @click="container">确定</el-button>
        <el-button type="default"
                   @click="close">取消</el-button>
      </div>
    </el-dialog>
  </span>
</template>
<script>
export default {
  name: "SplitDialog",
  props: {
    splitVisible: {
      type: Boolean,
    },
    id: {
      type: Number,
      default: 0,
    },
  },
  data () {
    return {
      ruleForm: {
        status: 1,
      },
      routerName: {
        1: "lineSplitting",
        2: "numSplitting",
      },
    };
  },

  methods: {
    // 跳转详情页面
    container () {
      this.$router.push({
        name: this.routerName[this.ruleForm.status],
        query: { waybillId: this.id },
      });
    },
    // 取消
    close () {
      this.$emit("update:splitVisible", false);
    },
  },
};
</script>
